<!DOCTYPE html>
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <link rel="StyleSheet" type="text/css" href="/tpa/admin.css" />
   <link rel="StyleSheet" type="text/css" href="/tpa/jquery-ui.css" />
   <link rel="StyleSheet" type="text/css" href="/tpa/jsTree.css" />
   
   <style type="text/css">
      #fields {
         columns: 190px 3;
         -webkit-columns: 190px 3;
         -moz-columns:190px 3;
      }
      #fields>span {
         display: inline-block;
         width: 190px;
      }
   </style>
   
   <script type="text/javascript" src="/lib/js/jquery.js"></script>
   <script type="text/javascript" src="/lib/js/jquery.ui.js"></script>
   <script type="text/javascript" src="/lib/js/meccano.js"></script>
   <script type="text/javascript" src="/lib/js/jquery.jstree.js"></script>
   
   <script type="text/javascript">
      $(document).ready(function(){
         $("#cats").jstree({
            "plugins" : ["themes",'json_data',"checkbox"],
            'checkbox': {
               'real_checkboxes': true,
               'real_checkboxes_names': function(n){
                  return ['f[category][]', n[0].id];
               }
            },
            'themes': {
               'theme' : 'classic'
            },
            'json_data': {
               'data': {%$jsonString%}
            }
         });
      });
   </script>
</head>
<body>

   <div style="padding: 10px 30px;">
      <form action="/admin/export.php" method="post">
         <input type="hidden" name="a" value="1" />
         <h3 style="border-bottom: 1px solid #CCC; margin-bottom: 10px;">Экспорт:</h3>
         <div id="cats" style="width: 260px; overflow-x: hidden; border-right: 1px dotted #CCC; float: left;"></div>

         <div id="fields" style="width: 600px; padding-left: 20px; float: left;">
            {%foreach from=$fields item='f'%}
            <span>
               <input type="checkbox" name="f[field][]" value="{%$f->alias%}" id="f_{%$f->alias%}" />
               <label for="f_{%$f->alias%}">{%$f->title%}</label>
            </span>
            {%/foreach%}
         </div>
         <div class="clear"></div><br />
         <input type="submit" value=" Экспорт " />
      </form>
   </div>
   <br /><br /><br />

   <div style="padding: 10px 30px;">
      <h3 style="border-bottom: 1px solid #CCC; margin-bottom: 10px;">Импорт:</h3>
      <form action="/admin/export.php" method="post" enctype="multipart/form-data">
         <input type="hidden" name="a" value="2" />
         <input type="file" name="f[import]" /><br />
         <input type="submit" value=" Импорт " />
      </form>
   </div>

</body>
</html>